<%@page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%@page import="com.shsh.safemanage.action.WriteProblemAction"%>
<%@page import="com.shsh.safemanage.model.Department3"%>
<%@page import="com.shsh.safemanage.model.Department2"%>
<%@page import="com.shsh.safemanage.dao.DepartmentDao"%>
<%@page import="com.shsh.safemanage.dao.TitlePostManageGroupDao"%>
<%@page import="com.shsh.safemanage.model.Role"%>
<%@page import="com.shsh.safemanage.model.User"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.EquipmentDao"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.model.Equipment"%>

<%
{
TitlePostManageGroupDao theTPMDao = DaoCreator.createTitlePostManageGroupDao();
DepartmentDao theDepartDao = DaoCreator.createDepartmentDao();

WriteProblemAction theWriteProblemAction = ActionCreator.createWriteProblemAction();

User loginUser = (User) session.getAttribute(Constants.SESSION_USER);
Department1 theDepartment1 = theDepartDao.getDepartment1ByID(loginUser.getDepartment1ID());
%>
<span style="margin-left: 40px" class="span1">作业部（业务中心）：</span>
<%
if (theDepartment1.getDepartmentType() == Constants.DEPARTMENT_TYPE_SHIYEBU) {
%>
<%=loginUser.getDepartment1Name()%>
<%
} else {
%>
<%@include file="depart_select/depart1_shiyebu_select_section.jsp" %>
<%
}
%>
<span style="margin-left: 20px" class="span1">装置：</span>
<%
Department3 depart3 = theDepartDao.getDepartment3ByID(loginUser.getDepartment3ID());
Role theRole = theTPMDao.getRoleByID(depart3.getRoleID());
int theIntRole = theWriteProblemAction.calRole(null, null, null, theRole);

if ((theIntRole & (Constants.ROLE_TYPE_YIXIANYUANGONG)) > 0) {
%>
<%=loginUser.getDepartment2Name()%>
<%
} else if ((theIntRole & (Constants.ROLE_TYPE_ZHUANGZHIZHANG)) > 0) {
%>
<%@include file="equip_select/user_mapping_equip_select_section.jsp" %>
<%
} else {
%>
<%-- @include file="equip_select/user_mapping_equip_select_section.jsp" --%>
<span id="equipOfDepartSpan">
<%@include file="equip_select/equipment_of_depart_select_section.jsp" %>
</span>
<%
}
%>

<script type="text/javascript">
function selectDepart1() {
	loadPageSection('<%=request.getContextPath()%>/equip_select/equipment_of_depart_select_section.jsp', 'equipOfDepartSpan', 
			{depart1ID: getElementValueByID('depart1')}, false, function() {changeEquip();} );
	loadPageSection('<%=request.getContextPath()%>/managegroup_select/manage_check_samepage_section.jsp', 'chooseManageGroupUserDiv', 
			{depart1ID: getElementValueByID('depart1')}, false);
}

selectDepart1();
</script>

<%
}
%>